package com.gofunbuy.app.member;

import com.gofunbuy.R;
import com.gofunbuy.TabMemberGroup;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;

public class SubMemberDocumentActivity extends Activity implements
		OnClickListener {
	private TextView tvBack,tvTitle;
	private LinearLayout linearDocument, linearDonate, linearPayHistory;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.member_document_layout);
		initLayout();
	}

	private void initLayout() {
		tvTitle = (TextView) findViewById(R.id.topbar_title);
		tvTitle.setText(R.string.title_member_detail);
		tvBack = (TextView) findViewById(R.id.topbar_back);
		tvBack.setOnClickListener(this);
		linearDocument = (LinearLayout) findViewById(R.id.id_document);
		linearDonate = (LinearLayout) findViewById(R.id.id_donate);
		linearPayHistory = (LinearLayout) findViewById(R.id.id_pay_history);
		linearDocument.setOnClickListener(this);
		linearDonate.setOnClickListener(this);
		linearPayHistory.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.topbar_back:
			startActivity(TabMemberActivity.class);
			break;
		case R.id.id_document:
			// startActivity(SubMemberDocumentActivity.class);
			break;
		case R.id.id_donate:
			startActivity(SubMemberIntegrationActivity.class);
			break;
		case R.id.id_pay_history:
			startActivity(SubMemberPayHistoryActivity.class);
			break;
		}
	}

	private void startActivity(Class<?> a) {
		// 要跳转的Activity
		// Log.v("名字", a.getSimpleName() + " " + a.getName());
		Intent intent = new Intent(SubMemberDocumentActivity.this, a);
		// 把Activity转换成一个Window，然后转换成View
		Window w = TabMemberGroup.group.getLocalActivityManager()
				.startActivity(a.getSimpleName(), intent);
		View view = w.getDecorView();
		// 设置要跳转的Activity显示为本ActivityGroup的内容
		TabMemberGroup.group.setContentView(view);
	}

}
